home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ For TASM / USRGUIDE.PAK / DOTOTAL.ASM < prev    next >
Assembly Source File  |  1996-02-21  |  1KB  |  34 lines

  1. ; Turbo Assembler example. Copyright (c) 1993 By Borland International, Inc.
  2. ;
  3. ; DOTOTAL.ASM - Example for interfacing C++ and Turbo Assembler
  4. ;
  5. ; Usage: bcc showtot.cpp dototal.asm
  6. ;
  7. ; From the Turbo Assembler User's Guide
  8. ; Ch. 18: Interfacing Turbo Assembler with Borland C++
  9.  
  10.        .MODEL  SMALL                ;select small model 
  11.                                     ;(nearcode and data)
  12.        .DATA                        ;TC-compatible initialized
  13.                                     ;data segment
  14.        EXTRN   _Repetitions:WORD    ;externally defined
  15.        PUBLIC  _StartingValue       ;available to other modules
  16. _StartingValue  DW  0
  17.        .DATA?                       ;TC-compatible uninitialized
  18.                                     ;data segment
  19. RunningTotal    DW  ?
  20.        .CODE                        ;TC-compatible code segment
  21.        PUBLIC  _DoTotal
  22. _DoTotal        PROC                ;function (near-callable in
  23.                                     ;small model)
  24.        mov     cx,[_Repetitions]    ;# of counts to do
  25.        mov     ax,[_StartingValue]
  26.        mov     [RunningTotal],ax    ;set initial value
  27. TotalLoop:
  28.        inc     [RunningTotal]       ;RunningTotal++
  29.        loop    TotalLoop
  30.        mov     ax,[RunningTotal]    ;return final total
  31.        ret
  32. _DoTotal        ENDP
  33.        END
  34.